home *** CD-ROM | disk | FTP | other *** search
/ SGI Varsity Update 1998 August / SGI Varsity Update 1998 August.iso / dist / insight.idb / usr / include / make / commonhelprules.z / commonhelprules
Text File  |  1998-07-29  |  4KB  |  115 lines

  1. #    Common rules for making xhelp book
  2.  
  3. default xhelp help: mk_help copy_figures
  4.  
  5. ${BOOKDIR}/${BOOK}.sgm: ${HELP_FILE}
  6.     -@mkdir -p ${BOOKDIR} 1> /dev/null 2>&1
  7.     @${RM} -f ${BOOKDIR}/${BOOK}.sgm;    
  8.     @${CP} ${HELP_FILE} ${BOOKDIR}/${BOOK}.sgm
  9.  
  10. # notice that any tdr files less than 37 in length are being removed
  11. mk_help: prep_book
  12.     @(EBTRC=${EBTRC}; TOOLROOT=${ITOOLROOT}; export EBTRC TOOLROOT; \
  13.         ${MKHELP} -col . ${BOOK})
  14.     -@${RM} -f `${LS} -l ${BOOKDIR}/ebt/*.tdr | ${AWK} '{if ($$5 < 37) print $$9}'`
  15.  
  16. booklist.txt: Makefile
  17.     @if [ -f booklist.txt ] ; then \
  18.         ${MV} booklist.txt booklist.txt.old; \
  19.     fi
  20.     @echo '<BOOK name="${TITLE}" alias="${FULL_TITLE}" type="generic" hide="${HIDDEN}" version="${VERSION}" srchres="0" srchtags="HELPLABEL,HELPTOPIC TITLE:Titles:1;TITLE,FIGURE:Figure Captions:1;EXAMPLE:Code Examples">' > booklist.txt
  21.  
  22. prep_book: ${BOOKDIR}/${BOOK}.sgm booklist.txt
  23.     -@mkdir -p ${BOOKDIR}/ebt 1> /dev/null 2>&1
  24.     -@mkdir -p ${BOOKDIR}/index 1> /dev/null 2>&1
  25.     @if [ ! -f ${BOOKDIR}/${BOOK}.dtd ] ; then \
  26.         ln -s ${XHELP_LIB}/dtd/XHELP.dtd ${BOOKDIR}/${BOOK}.dtd; \
  27.     fi
  28.     @if [ ! -d  ${BOOKDIR}/styles ] ; then \
  29.         ln -s ${XHELP_LIB}/styles ${BOOKDIR}/styles; \
  30.     fi
  31.  
  32. copy_figures:
  33.     @if [ -d online ] ; then \
  34.         if [ ! -d ${BOOKDIR}/figures ] ; then \
  35.         mkdir -p ${BOOKDIR}/figures; fi ; \
  36.         ${RM} -f ${BOOKDIR}/figures/* ; \
  37.         (cd online; for i in *; do \
  38.         ${CP} $$i ../${BOOKDIR}/figures/$$i ;\
  39.         done; cd ..) ; \
  40.     elif [ -d figures ] ; then \
  41.         if [ ! -d ${BOOKDIR}/figures ] ; then \
  42.         mkdir -p ${BOOKDIR}/figures; fi ; \
  43.         ${RM} -f ${BOOKDIR}/figures/* ; \
  44.         (cd figures; for i in *; do \
  45.         ${CP} $$i ../${BOOKDIR}/figures/$$i ;\
  46.         done; cd ..) ; \
  47.     fi
  48.  
  49. verify:
  50.     ${SGMLRVW} -quiet -verifyMore -dtd ${XHELP_DTD} -f ${BOOK}.sgm
  51.  
  52. install:: copy_figures
  53.     $(INSTALL) -u root -g sys  -m 755 \
  54.         -idb '${BOOKSUBSYSTEM} exitop("(chroot \$$rbase /usr/sbin/insightAdmin -avf ${BOOKSHELF}>>/dev/null)2>>/dev/null")' -dir ${BOOKSHELF}/${BOOKDIR}
  55.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  56.         -dir ${BOOKSHELF}/${BOOKDIR}/ebt
  57.     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  58.         ${BOOKSUBSYSTEM} ${BOOKDIR}/ebt/*
  59.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  60.         -dir ${BOOKSHELF}/${BOOKDIR}/index
  61.     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  62.         ${BOOKSUBSYSTEM} ${BOOKDIR}/index/*
  63.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  64.         -dir ${BOOKSHELF}/${BOOKDIR}/styles
  65.     $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  66.         ${BOOKSUBSYSTEM} ${BOOKDIR}/styles/*
  67.     if [ -d online ] ; then \
  68.         $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  69.             -dir ${BOOKSHELF}/${BOOKDIR}/figures ; \
  70.         $(INSTALL) -m 644 -f ${BOOKSHELF} -idb \
  71.             ${BOOKSUBSYSTEM} ${BOOKDIR}/figures/* \
  72.     ; fi
  73.     if [ -d help ] ; then \
  74.         if [ "${BOOK_LANG}" = "C" ] ; then \
  75.              $(INSTALL) -m 644 -f ${HELPDIR} \
  76.             -idb ${HELPSUBSYSTEM} help/* ; \
  77.         else \
  78.               (cd help; \
  79.             $(INSTALL) -m 644 -f ${HELPDIR}/help/${BOOK_LANG}\
  80.             -idb ${HELPSUBSYSTEM} * ; cd ..) ; \
  81.         fi \
  82.     ; fi
  83.     $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR} \
  84.         -idb ${BOOKSUBSYSTEM} booklist.txt
  85.  
  86. # make images for this book
  87. images: xhelp
  88.     @RAWIDB=$(IDBFILE); export RAWIDB ; \
  89.         if [ -f $$RAWIDB ] ; then mv $$RAWIDB $$RAWIDB.prev ; fi ; \
  90.         echo "RAWIDB=$$RAWIDB SRC=$(SRC) $(MAKE) install" ; \
  91.         $(MAKE) SRC=$$SRC install ; \
  92.     sort +4 -5 $$RAWIDB -o idb
  93.     @newvnum=`${MKVNUM} -r "102" -b ""  -t "0" -f ""` ; \
  94.     echo "$$newvnum" > .version_number; \
  95.     VERSION=`cat .version_number` ; export VERSION ; \
  96.     if [ ! -d images ]; then mkdir images; fi; \
  97.     (cd images; rm -f *) ; \
  98.     RAWIDB=$(IDBFILE); export RAWIDB ; \
  99.     USEALLIMAGES=`grep "^[     ]*product" < spec | awk '{list=list $2 " "}END{print list}'` ; \
  100.     sort +4 -5 $$RAWIDB -o finalidb; \
  101.     echo "${GENDIST} -verbose -all -root /"; \
  102.     echo "\t-source `pwd` -idb finalidb"; \
  103.     echo "\t-spec spec -dist images $$USEALLIMAGES"; \
  104.     ${GENDIST} -verbose -all -root / -source / \
  105.         -idb finalidb -spec spec -dist images $$USEALLIMAGES
  106.  
  107. # Remove the files in the 'books' sub directory and the image files.
  108. clean::
  109.     ${RM} -rf ${BOOKDIR}/ebt ${BOOKDIR}/index ${BOOKDIR}/styles
  110.     ${RM} -rf ${BOOKDIR}/entities ${BOOKDIR}/figures
  111.     ${RM} -f ${BOOKDIR}/${BOOK}.dtd ${BOOKDIR}/${BOOK}.sgm
  112.     ${RMDIR} ${BOOKDIR} books
  113.     ${RM} -f booklist.txt* finalidb IDB.prev IDB .version_number idb
  114.     ${RM} -rf images
  115.